<script setup lang="ts">
import dayjs from 'dayjs'
defineProps<{ articel: ArticelModel }>()
</script>
<template>
   <div @click="$router.push({ name: 'detail', params: { id: articel.id } })">
      <div>
         <div class="text-base text-slate-800 font-bold">{{ articel.title }} <span
               :class="articel.status == 1 ? 'text-green-500' : articel.status == 2 ? 'text-red-500' : 'text-yellow-500'"
               class=" ml-2 font-normal text-sm">{{
                  articel.status
                  == 1 ? '已发布' :
                  articel.status == 2 ? '审核未通过' : '审核中' }}</span> </div>

         <div>
            <span>{{ (articel.user?.nickname || articel.user?.username) + ' | ' }}</span>
            <span>{{ dayjs(articel.createDate).fromNow() }}</span>
         </div>
         <div class="flex justify-between items-center">
            <div class="text-clip h-24 p-2 leading-7">
               {{ articel.content }}
            </div>
            <img class="w-24 h-24 object-cover" :src="articel.previewImg" />
         </div>
      </div>
   </div>
</template>
